Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: QuickTime

Previous | Overview | Contents | Next |

Movie Posters and Movie Previews

A QuickTime movie may contain a preview and a poster. A movie preview is a very short version of a movie, typically less than five seconds in duration. The preview is intended to give the user an idea of a movie's contents.

A movie poster is a still frame representing the movie.

This section describes the Movie Toolbox functions that allow your application to work with movie previews and movie posters.

Use the PlayMoviePreview function to display a movie's preview. The PlayMoviePreview function sets the movie into preview mode, plays the movie preview, sets the movie back to normal playback mode, and returns to your application.

Alternatively, your application can control the playback of a movie's preview. Use the SetMoviePreviewMode function to place a movie into preview mode. You can then use the StartMovie and StopMovie functions to control movie playback--these functions are described on StartMovie and StopMovie , respectively. Your application can find out if a movie is in preview mode by calling the GetMoviePreviewMode function.

Your application can specify the starting time and duration of the movie preview with the SetMoviePreviewTime and GetMoviePreviewTime functions.

Use the ShowMoviePoster function to display a movie's poster. You can work with the poster's boundary rectangle using the SetPosterBox and GetPosterBox functions. Your application can work with the starting time of the poster with the SetMoviePosterTime and GetMoviePosterTime functions. Posters always have no duration.

Tracks may be specified for use in the movie, its preview, its poster, or any combination of the three. So, for example, when the Movie Toolbox plays the movie preview it uses only those tracks that are assigned to the preview. Your application controls the use of a movie's tracks with the SetTrackUsage function. You can find out how a track is used by calling the GetTrackUsage function.

SetTrackUsage

The SetTrackUsage function allows your application to specify whether a track is used in a movie, its preview, its poster, or a combination of these.

pascal void SetTrackUsage (Track theTrack, long usage);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

usage
Contains flags that specify how the track is to be used. The following flags are defined (be sure to set unused flags to 0):

trackUsageInMovie
The track is used in the movie. If this flag is set to 1, the track is used in the movie.

trackUsageInPreview
The track is used in the preview. If this flag is set to 1, the track is used in the preview.

trackUsageInPoster
The track is used in the poster. If this flag is set to 1, the track is used in the poster.

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

SEE ALSO

Your application can determine how a track is used by calling the GetTrackUsage function, which is described in the next section.

GetTrackUsage

The GetTrackUsage function allows your application to determine whether a track is used in a movie, its preview, its poster, or a combination of these. Your application can specify how a track is used by calling the SetTrackUsage function, which is described in the previous section.

pascal long GetTrackUsage (Track theTrack);
theTrack
Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as NewMovieTrack and GetMovieTrack (described on NewMovieTrack and GetMovieTrack , respectively).

DESCRIPTION

The GetTrackUsage function returns a long integer that contains flags indicating the track's usage. The following flags are defined (unused flags are set to 0):

trackUsageInMovie
The track is used in the movie. If this flag is set to 1, the track is used in the movie.

trackUsageInPreview
The track is used in the movie preview. If this flag is set to 1, the track is used in the preview.

trackUsageInPoster
The track is used in the movie poster. If this flag is set to 1, the track is used in the poster.

ERROR CODES

invalidTrack

-2009

This track is corrupted or invalid

ShowMoviePoster

You can use the ShowMoviePoster function to display a movie's poster. The movie poster uses the movie's matrix and display clipping characteristics.

pascal void ShowMoviePoster (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

DESCRIPTION

The Movie Toolbox draws the movie poster once, in the movie's graphics world. This function works on active and inactive movies.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

You can set the poster's starting time with the SetMoviePosterTime function (described on SetMoviePosterTime ). You can set the position and size of the poster by calling the SetPosterBox function (described in the next section).

SetPosterBox

You can use the SetPosterBox function to set a poster's boundary rectangle. You define the poster's image by specifying a time in the movie (use the SetMoviePosterTime function, described on SetMoviePosterTime ). You specify the size and position of the poster image with this function.

pascal void SetPosterBox (Movie theMovie, const Rect *boxRect);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

boxRect
Contains a pointer to a rectangle. The Movie Toolbox sets the poster's boundary rectangle to the coordinates specified in the structure referred to by this parameter.

DESCRIPTION

If you do not specify a boundary rectangle for the poster, the Movie Toolbox uses the movie's matrix when it displays the poster.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

invalidRect

-2036

Specified rectangle has invalid coordinates

SEE ALSO

Your application can retrieve a poster's boundary rectangle by calling the GetPosterBox function, which is described in the next section.

GetPosterBox

The GetPosterBox function allows you to obtain a poster's boundary rectangle.

pascal void GetPosterBox (Movie theMovie, Rect *boxRect);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

boxRect
Contains a pointer to a rectangle. The Movie Toolbox returns the poster's boundary rectangle into the structure referred to by this parameter.

DESCRIPTION

When you call GetPosterBox without having called SetPosterBox , the current movie matrix is applied to the poster tracks to determine the poster box.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

You set the poster's boundary rectangle by calling the SetPosterBox function, which is described in the previous section.

SetMoviePosterTime

The SetMoviePosterTime function sets the poster time for the movie. Since a movie poster is a still frame, it is defined by a point in time within the movie. The poster's time is expressed in the movie's time coordinate system. Your application can retrieve a poster's time by calling the GetMoviePosterTime function, which is described in the next section.

pascal void SetMoviePosterTime (Movie theMovie,
                                         TimeValue posterTime);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

posterTime
Contains the starting time for the movie frame that contains the poster image.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

invalidTime

-2015

This time value is invalid

SEE ALSO

Your application can set the poster's boundary rectangle by calling the SetPosterBox function, which is described on SetPosterBox .

GetMoviePosterTime

The GetMoviePosterTime function returns the poster's time in the movie. Since a movie poster has no duration, a poster is defined by a point in time within the movie. The time value returned is in the time coordinate system of the movie.

pascal TimeValue GetMoviePosterTime (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

DESCRIPTION

The GetMoviePosterTime function returns a time value. This time value contains the starting time for the movie frame that contains the movie poster image.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

Your application can set a poster's time by calling the SetMoviePosterTime function, which is described in the previous section.

PlayMoviePreview

The PlayMoviePreview function plays a movie's preview.

pascal void PlayMoviePreview (Movie theMovie,
                                         MoviePreviewCallOutUPP callOutProc,
                                         long refcon);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

callOutProc
Contains a pointer to a movie callout function in your application. The Movie Toolbox calls this function repeatedly while the movie preview is playing. You can use this function to stop the preview. If you do not want to assign a function, set this parameter to nil .

Your function should have the following form:

                    pascal Boolean MyCallOutProc (long refcon);
The refCon parameter contains the reference constant you specified when you called the PlayMoviePreview function.

Your function returns a Boolean value. The Movie Toolbox examines this value before continuing. If your function sets this value to false , the Movie Toolbox stops the preview and returns to your application. For details, see "Movie Callout Functions" .

Note that if you call the GetMovieActiveSegment function (described on GetMovieActiveSegment ) from within your movie callout function, the Movie Toolbox will have changed the active movie segment to be the preview segment of the movie. The Movie Toolbox restores the active segment when the preview is done playing.

refcon
Contains a reference constant for your function. The Movie Toolbox passes this value to your function.

DESCRIPTION

The PlayMoviePreview function sets the movie into preview mode, plays the movie preview, sets the movie back to normal playback mode, and returns to your application. The Movie Toolbox plays the preview in the movie's graphics world.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

Use the SetMoviePreviewTime function, described on SetMoviePreviewTime , to define the starting time and duration of the movie preview.

SetMoviePreviewMode

The SetMoviePreviewMode function allows your application to place a movie into and out of preview mode. When a movie is in preview mode, only those tracks identified as preview tracks are serviced. You specify how a track is used by calling the SetTrackUsage function, which is described on SetTrackUsage .

pascal void SetMoviePreviewMode (Movie theMovie,
                                         Boolean usePreview);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

usePreview
Specifies the movie's mode. Set this parameter to true to place the movie into preview mode. Set this parameter to false to place the movie into normal playback mode.

DESCRIPTION

When you place a movie into preview mode, the Movie Toolbox sets the active movie segment to be the preview segment of the movie. When you take a movie out of preview mode and place it back in normal playback mode, the toolbox sets the active movie segment to be the entire movie. For information about working with active movie segments, see "Enhancing Movie Playback Performance," .

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

GetMoviePreviewMode

The GetMoviePreviewMode function allows your application to determine whether a movie is in preview mode. If a movie is in preview mode, only the movie's preview can be displayed. Your application can place a movie into and out of preview mode by calling the SetMoviePreviewMode function, which is described in the previous section.

pascal Boolean GetMoviePreviewMode (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

DESCRIPTION

The GetMoviePreviewMode function returns a Boolean value. If the movie is in preview mode, the function sets this return value to true . If the movie is in normal playback mode, the function sets this value to false .

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SetMoviePreviewTime

The SetMoviePreviewTime function allows your application to define the starting time and duration of the movie's preview. These time values are in the movie's time coordinate system.

pascal void SetMoviePreviewTime (Movie theMovie,
                                         TimeValue previewTime,
                                         TimeValue previewDuration);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

previewTime
Contains a time value that specifies the preview's starting time.

previewDuration
Contains a time value that specifies the preview's duration.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

invalidDuration

-2014

This duration value is invalid

invalidTime

-2015

This time value is invalid

SEE ALSO

Your application can retrieve the starting time and duration of the preview with the GetMoviePreviewTime function, which is described in the next section.

GetMoviePreviewTime

The GetMoviePreviewTime function returns the starting time and duration of the movie's preview. These time values are expressed in the movie's time coordinate system.

pascal void GetMoviePreviewTime (Movie theMovie,
                                         TimeValue *previewTime,
                                         TimeValue *previewDuration);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

previewTime
Contains a pointer to a time value. The Movie Toolbox places the preview's starting time into the field referred to by this parameter. If the movie does not have a preview, the Movie Toolbox sets this returned value to 0.

previewDuration
Contains a pointer to a time value. The Movie Toolbox places the preview's duration into the field referred to by this parameter. If the movie does not have a preview, the Movie Toolbox sets this returned value to 0.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

Your application sets the starting time and duration of the movie preview with the SetMoviePreviewTime function, which is described in the previous section.


© 1999 Apple Computer, Inc.

Previous | Overview | Contents | Next